<#assign pojo=oneToManyPojo.getOne()>
<#assign many=oneToManyPojo.getMany()>
<#assign ones=oneToManyPojo.getOnes()>
<#assign module=oneToManyPojo.getModule()>
<#assign fields=pojo.getFilterdPojoFields()>
<#assign declarationName = pojo.importType(pojo.getDeclarationName())>
<#assign declarationNameFirstLetterLower = pojo.importType(pojo.getDeclarationNameFirstLetterLower())>
<#assign realPackageAndClassPath = "${pojo.getRealPackageAndClassPath()}">
<#assign masterid = pojo.getDeclarationNameFirstLetterLower()+"Id">
import React, { PropTypes } from 'react'
import { routerRedux } from 'dva/router'
import { connect } from 'dva'
import ${declarationName}Filter from '../components/${declarationName}Filter'
import ${declarationName}ToolBar from '../components/${declarationName}ToolBar'
import ${declarationName}List from '../components/${declarationName}List'
import ${declarationName}Modal from '../components/${declarationName}Modal'
<#foreach child in many>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>
<#assign childdeclarationNameFirstLetterLower = child.importType(child.getDeclarationNameFirstLetterLower())>
import ${childdeclarationName}Modal from '../components/${childdeclarationName}Modal'
import ${childdeclarationName}List from '../components/${childdeclarationName}List'
import ${childdeclarationName}ToolBar from '../components/${childdeclarationName}ToolBar'
<#if child.getRelation() == "MANY_DEFAULT">
import ${childdeclarationName}Select from "../components/${childdeclarationName}Select";
</#if>
</#foreach>

import {Modal, notification } from 'antd'
import {Link} from 'dva/router'
const confirm = Modal.confirm

import {get${declarationName}IndexConfig} from "../config/${declarationName}Index"
<#foreach child in many>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>
<#assign childdeclarationNameFirstLetterLower = child.importType(child.getDeclarationNameFirstLetterLower())>
import {get${childdeclarationName}SelectConfig} from "../config/${childdeclarationName}Index";
</#foreach>

function ${declarationName} ({ location, dispatch, ${declarationNameFirstLetterLower}, loading ,
<#foreach child in many>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>
<#assign childdeclarationNameFirstLetterLower = child.importType(child.getDeclarationNameFirstLetterLower())>
<#if child.getRelation() == "MANY_DEFAULT">
    ${childdeclarationNameFirstLetterLower},
</#if>
</#foreach>
}) {

  const {
    ${declarationNameFirstLetterLower}FilterProps,
    ${declarationNameFirstLetterLower}ToolBarProps,
    ${declarationNameFirstLetterLower}ListProps,
    ${declarationNameFirstLetterLower}ModalProps,
<#foreach child in many>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>
<#assign childdeclarationNameFirstLetterLower = child.importType(child.getDeclarationNameFirstLetterLower())>
    ${childdeclarationNameFirstLetterLower}ListProps,
    ${childdeclarationNameFirstLetterLower}ToolBarProps,
    ${childdeclarationNameFirstLetterLower}ModalProps,
<#if child.getRelation() == "MANY_DEFAULT">
    ${childdeclarationNameFirstLetterLower}SelectVisible,
    on${childdeclarationName}Selected,
    on${childdeclarationName}SelectedCancel,
</#if>
</#foreach>
  } = get${declarationName}IndexConfig(location, dispatch, ${declarationNameFirstLetterLower}, loading);

<#foreach child in many>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>
<#assign childdeclarationNameFirstLetterLower = child.importType(child.getDeclarationNameFirstLetterLower())>
<#if child.getRelation() == "MANY_DEFAULT">
const ${childdeclarationNameFirstLetterLower}SelectProps = get${childdeclarationName}SelectConfig(location, dispatch, ${childdeclarationNameFirstLetterLower}, loading,
    ${childdeclarationNameFirstLetterLower}SelectVisible,on${childdeclarationName}Selected,on${childdeclarationName}SelectedCancel);
</#if>
</#foreach>

  return (
    <div className='content-inner'>
        <${declarationName}Filter {...${declarationNameFirstLetterLower}FilterProps} />
        <${declarationName}ToolBar {...${declarationNameFirstLetterLower}ToolBarProps} />
        <${declarationName}List {...${declarationNameFirstLetterLower}ListProps} />
        <${declarationName}Modal {...${declarationNameFirstLetterLower}ModalProps} />
<#foreach child in many>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>
<#assign childdeclarationNameFirstLetterLower = child.importType(child.getDeclarationNameFirstLetterLower())>
        <${childdeclarationName}Modal {...${childdeclarationNameFirstLetterLower}ModalProps} />
<#if child.getRelation() == "MANY_DEFAULT">
        <${childdeclarationName}Select {...${childdeclarationNameFirstLetterLower}SelectProps}/>
</#if>
</#foreach>
    </div>
  )
}

${declarationName}.propTypes = {
  ${declarationNameFirstLetterLower}: PropTypes.object,
  location: PropTypes.object,
  dispatch: PropTypes.func,
  loading: PropTypes.object,
}

export default connect(({ ${declarationNameFirstLetterLower}, loading,
 <#foreach child in many>
 <#assign childdeclarationName = child.importType(child.getDeclarationName())>
 <#assign childdeclarationNameFirstLetterLower = child.importType(child.getDeclarationNameFirstLetterLower())>
 <#if child.getRelation() == "MANY_DEFAULT">
     ${childdeclarationNameFirstLetterLower},
 </#if>
 </#foreach>
 }) => ({ ${declarationNameFirstLetterLower}, loading: loading,
<#foreach child in many>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>
<#assign childdeclarationNameFirstLetterLower = child.importType(child.getDeclarationNameFirstLetterLower())>
<#if child.getRelation() == "MANY_DEFAULT">
    ${childdeclarationNameFirstLetterLower},
</#if>
</#foreach>
 }))(${declarationName})
/**
        ,{
          path: '${declarationNameFirstLetterLower}',
          getComponent (nextState, cb) {
            require.ensure([], require => {
              registerModel(app, require('./${module}/models/${declarationName}'))
<#foreach child in many>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>
<#assign childdeclarationNameFirstLetterLower = child.importType(child.getDeclarationNameFirstLetterLower())>
<#if child.getRelation() == "MANY_DEFAULT">
              registerModel(app, require('./builder/models/${childdeclarationName}'))
</#if>
</#foreach>
              cb(null, require('./${module}/pages/${declarationName}Index'))
            }, '${declarationNameFirstLetterLower}')
          }
        }, {
          path: '${declarationNameFirstLetterLower}/:id',
          getComponent (nextState, cb) {
            require.ensure([], require => {
              registerModel(app, require('./${module}/models/${declarationName}Detail'))
              cb(null, require('./${module}/pages/${declarationName}Detail'))
            }, '${declarationNameFirstLetterLower}-detail')
          }
        },
<#foreach child in many>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>
<#assign childdeclarationNameFirstLetterLower = child.importType(child.getDeclarationNameFirstLetterLower())>
        {
          path: '${declarationNameFirstLetterLower}/${childdeclarationNameFirstLetterLower}/:id',
          getComponent (nextState, cb) {
            require.ensure([], require => {
              registerModel(app, require('./builder/models/${declarationName}${childdeclarationName}'))
              cb(null, require('./builder/pages/${declarationName}${childdeclarationName}Index'))
            }, '${declarationNameFirstLetterLower}-${childdeclarationNameFirstLetterLower}')
          }
        },
</#foreach>

  {
    id: '${declarationNameFirstLetterLower}',
    name: '${declarationNameFirstLetterLower}',
    router: '/${declarationNameFirstLetterLower}',
  },
  {
    id: '${declarationNameFirstLetterLower}Detail',
    mpid: -1,
    bpid: '${declarationNameFirstLetterLower}',
    name: '${declarationNameFirstLetterLower} Detail',
    router: '/${declarationNameFirstLetterLower}/:id',
  },
<#foreach child in many>
<#assign childdeclarationName = child.importType(child.getDeclarationName())>
<#assign childdeclarationNameFirstLetterLower = child.importType(child.getDeclarationNameFirstLetterLower())>
  {
    id: '${declarationNameFirstLetterLower}-${childdeclarationNameFirstLetterLower}',
    mpid: -1,
    bpid: ${declarationNameFirstLetterLower},
    name: '${declarationNameFirstLetterLower}-${childdeclarationNameFirstLetterLower}',
    router: '/${declarationNameFirstLetterLower}/${childdeclarationNameFirstLetterLower}/:id',
  },
</#foreach>
**/